package com.zsl.springboot.bootdemo.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class IndexController {

    @RequestMapping("/sy.html")
    public String hello(){
        return "index";
    }

    @RequestMapping("/404")
    public String notFound(){
        return "404";
    }

    @RequestMapping("/about.html")
    public String about(){
        return "about";
    }

    @RequestMapping("/form.html")
    public String form(){
        return "form";
    }

    @RequestMapping("/music.html")
    public String music(){
        return "music";
    }

    @RequestMapping("/music2.html")
    public String music2(){
        return "music2";
    }

    @RequestMapping("/music3.html")
    public String music3(){
        return "music3";
    }

    @RequestMapping("/testWebSocket.html")
    public String testWebSocket(){
        return "testWebSocket";
    }

    @RequestMapping("/VIP.html")
    public String VIP(){
        return "VIP";
    }

//    @RequestMapping("/export")
//    public void export(@RequestParam("sfz") String fileName){
//        File file = new File(fileName);
//        BufferedReader reader = null;
//        StringBuffer sbf = new StringBuffer();
//        try {
//            reader = new BufferedReader(new FileReader(file));
//            String tempStr;
//            while ((tempStr = reader.readLine()) != null) {
//                System.out.println();
//            }
//            reader.close();
//        } catch (IOException e) {
//            e.printStackTrace();
//        } finally {
//            if (reader != null) {
//                try {
//                    reader.close();
//                } catch (IOException e1) {
//                    e1.printStackTrace();
//                }
//            }
//        }
//    }

//    public static void main(String[] args) throws IOException {
////        exchangeSFZ();
//        sxSFZ();
//    }
//
//    public static void sxSFZ() throws IOException {
//        String fileName="F:\\money\\7";
//        File file = new File(fileName);
//        BufferedReader reader = null;
//        FileOutputStream fos = null;
//        StringBuffer sbf = new StringBuffer();
//        try {
//            reader = new BufferedReader(new FileReader(file));
//            String tempStr;
//            String filePath="F:\\money\\6";
//            fos = new FileOutputStream(filePath);
//            int i = 0;
//            while ((tempStr = reader.readLine()) != null) {
//                String[] x = tempStr.split("\\|");
//                String sfz = x[1];
//                String name = x[0];
//                //342401199701144955
//                int year = Integer.parseInt(sfz.substring(6,10));
//                int sex = Integer.parseInt(sfz.substring(16,17));
//                if (year > 1970 & year <= 1990 & (sex%2!=0) & i<10000 & sfz.startsWith("330")){
//                    i++;
//                    StringBuilder stringBuilder = new StringBuilder();
//                    stringBuilder.append(name);
//                    stringBuilder.append("----");
//                    stringBuilder.append(sfz);
//                    stringBuilder.append(System.getProperty("line.separator"));
//                    fos.write(stringBuilder.toString().getBytes());
//                }
//            }
//            reader.close();
//            fos.close();
//        } catch (IOException e) {
//            e.printStackTrace();
//        } finally {
//            if (reader != null) {
//                try {
//                    reader.close();
//                } catch (IOException e1) {
//                    e1.printStackTrace();
//                }
//            }
//            if (fos != null) {
//                try {
//                    fos.close();
//                } catch (IOException e1) {
//                    e1.printStackTrace();
//                }
//            }
//        }
//    }
//
//    public static void exchangeSFZ() throws IOException {
//        InputStreamReader isr = new InputStreamReader(new FileInputStream("F:\\money\\1200wsfz"),"GBK");
//        //2.创建OutputTreamWrite对象，构造方法中传递字节输出流和指定的编码表名称UTF-8
//        OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream("F:\\money\\7"),"utf-8");
//        //3.使用InputStreamReader对象中的方法read读取文件
//        int len = 0;
//        while ((len = isr.read()) != -1){
//            //4.使用OutputTreamWrite对象中的方法write，把读取的数据写入到文件中
//            osw.write(len);
//        }
//        //5.释放资源
//        osw.close();
//        isr.close();
//    }
}
